package com.jxw.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.jxw.entity.AppInfoTG;
import com.jxw.launcher.R;
import java.util.ArrayList;
import java.util.List;

/* loaded from: classes.dex */
public class APPYWadapter extends RecyclerView.Adapter<ViewHolder> {
    private List<AppInfoTG.DataDTO> appInfos;
    private int choosePosition = 0;
    RelativeLayout contentItemBg;
    private Context context;
    private int layoutItem;
    private OnRecyclerItemClickListener mOnItemClinckListener;

    /* loaded from: classes.dex */
    public interface OnRecyclerItemClickListener {
        void OnRecyclerItemClickListener(int i);
    }

    public APPYWadapter(Context context, List<AppInfoTG.DataDTO> list, int i) {
        this.appInfos = new ArrayList();
        this.context = context;
        this.appInfos = list;
        this.layoutItem = i;
    }

    @Override // android.support.v7.widget.RecyclerView.Adapter
    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new ViewHolder(LayoutInflater.from(this.context).inflate(this.layoutItem, viewGroup, false));
    }

    @Override // android.support.v7.widget.RecyclerView.Adapter
    public void onBindViewHolder(ViewHolder viewHolder, int i) {
        viewHolder.title.setText(this.appInfos.get(i).getAppName());
        Glide.with(this.context).load(this.appInfos.get(i).getIconPath()).apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(25)).diskCacheStrategy(DiskCacheStrategy.AUTOMATIC).skipMemoryCache(false)).into(viewHolder.iconImg);
        Log.i("appInfos", "appInfos" + this.appInfos.get(i).getAppName() + "__" + this.appInfos.get(i).getIconPath());
    }

    public void setChoosePosition(int i) {
        this.choosePosition = i;
        notifyDataSetChanged();
    }

    @Override // android.support.v7.widget.RecyclerView.Adapter
    public int getItemCount() {
        List<AppInfoTG.DataDTO> list = this.appInfos;
        if (list == null) {
            return 0;
        }
        return list.size();
    }

    public void setData(List<AppInfoTG.DataDTO> list) {
        if (list != null) {
            this.appInfos = list;
        }
        notifyDataSetChanged();
    }

    public void setOnItemClickListener(OnRecyclerItemClickListener onRecyclerItemClickListener) {
        this.mOnItemClinckListener = onRecyclerItemClickListener;
    }

    /* loaded from: classes.dex */
    public class ViewHolder extends RecyclerView.ViewHolder {
        private ImageView iconImg;
        private TextView title;

        public ViewHolder(View view) {
            super(view);
            this.title = (TextView) view.findViewById(R.id.app_title);
            this.iconImg = (ImageView) view.findViewById(R.id.app_image);
            view.setOnClickListener(new View.OnClickListener() { // from class: com.jxw.adapter.APPYWadapter.ViewHolder.1
                @Override // android.view.View.OnClickListener
                public void onClick(View view2) {
                    if (APPYWadapter.this.mOnItemClinckListener != null) {
                        APPYWadapter.this.mOnItemClinckListener.OnRecyclerItemClickListener(ViewHolder.this.getAdapterPosition());
                    }
                }
            });
        }
    }
}
